﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using FacebookLoginButton.Models;
using FacebookLoginButton.Controllers;

namespace FacebookLoginButton.DAL
{
    public class FacebookInitializer<FacebookContext> : IDatabaseInitializer<FacebookContext>
        where FacebookContext : DbContext
    {
        public void InitializeDatabase(FacebookContext context)
        {
            // Create our database if it doesn't already exist.
            context.Database.CreateIfNotExists();

            // Do you want to migrate to latest in your initializer? Add code here!

            // Do you want to seed data in your initializer? Add code here!
        }
    }
    /*
    public class FacebookInitializer : DropCreateDatabaseIfModelChanges<FacebookContext>
    {

        FacebookUser currentUser;
        /*
        protected FacebookUser getPlutoUser(string sessionToken)
        {
            AccountController controller = new AccountController();
            currentUser = controller.getFBUser(sessionToken);
            return controller.getFBUser(sessionToken);
        }

        //protected List<FacebookUser> getPlutoFriendList(string sessionToken)
        //{
          //  return currentUser.friendsList;
        //}

        protected override void Seed(FacebookContext context)
        {
            // Adding Pluto Users
            //var user = new List<FacebookUser>();
            //FacebookUser pluto = getPlutoUser(context.token);
            //user.Add(pluto);
            //user.ForEach(s => context.PlutoUser.Add(s));
            //context.SaveChanges();

            // Adding Friends of Pluto Users
            //var userFriends = new List<FacebookFriendsModel>();
            //userFriends.Add(getPlutoFriendList(context.token));
            //userFriends.ForEach(s => context.PlutoUserFriends.Add(s));
            //context.SaveChanges();
        }
    }*/
}